import { Component, EventTouch, Sprite, _decorator, Node } from 'cc';
import PopupHelper from "../../helper/PopupHelper"
import ImageViewDialog from '../popup/ImageViewDialog'
const {ccclass,property} = _decorator
/*
 * @LastEditTime: 2021-08-25 15:56:12
 * @LastEditors: 潘军桥
 * @Description: 点击图片弹窗放大查看，该组件需要配合ClickControl一起使用
 * @FilePath: assets/scripts/components/control/ImageZoomViewControl.ts
 */
@ccclass
export default class ImageZoomViewControl extends Component {
    protected onEnable(): void {
        this.node.on('click',this.onQuestionImgClick,this)
    }
    protected onDisable(): void {
        this.node.off('click',this.onQuestionImgClick,this)
    }
    private onQuestionImgClick(e:EventTouch){
        console.log('ExerciseDialog onQuestionImgClick')
        console.log(e.target.uuid)
        //if(e.target.node==this.node)e.propagationImmediateStopped=true
        //const pool=PoolHelper.getInstance()
        const popup=PopupHelper.getInstance()
        popup.openDialog('ImageViewDialog').then(node=>{
            const dialog=node.getComponent(ImageViewDialog)
            dialog.setSpriteFrame(this.getComponent(Sprite).spriteFrame)
        })
        //popup.show(node)
        
    }
}